package com.guoyw.leetcode.question.answer;

import java.util.Arrays;
import java.util.Collections;
import java.util.stream.IntStream;
import java.util.stream.Stream;

/**
 * @Description: 215. 数组中的第K个最大元素
 * @Author: guoyw
 * @CreateDate: 2021/3/25 6:36 下午
 * @Version: 1.0
 */

public class C215 {

  public int findKthLargest(int[] nums, int k) {
    IntStream stream = Arrays.stream(nums);
    Stream integerStream = stream.boxed();
    Integer[] integers = (Integer[]) integerStream.toArray(Integer[]::new);
    Arrays.sort(integers, Collections.reverseOrder());
    return integers[k-1];
  }
}
